extends Area2D

var player_in_range:bool=false


func _on_body_entered(body) -> void:
	if body.name =="player":
		player_in_range=true

func _on_body_exited(body) -> void:
	if body.name =="player":
		player_in_range=false
		
func _input(event):
	if event.is_action_pressed("pick_up") and player_in_range and GameUtiles.move_allow:
		if GameUtiles.player_bag.get("sharp_axe",0) >0 or GameUtiles.ingredients.has("sharp_axe"):
			GameUtiles.add_item("wood")
			get_parent().queue_free()
		else:
			DialogueManager.show_dialogue_balloon(load("res://dialogues/items/wood.dialogue"),"wood")
		
